package com.cy.demo.pojo;


import java.util.Objects;

public class Cart extends BaseEntity {
    private int cid;
    private int uid;
    private int pid;
    private long price;
    private int num;

    public Cart() {
    }

    public Cart(int cid, int uid, int pid, long price, int num) {
        this.cid = cid;
        this.uid = uid;
        this.pid = pid;
        this.price = price;
        this.num = num;
    }

    public int getCid() {
        return cid;
    }

    public int getUid() {
        return uid;
    }

    public int getPid() {
        return pid;
    }

    public long getPrice() {
        return price;
    }

    public int getNum() {
        return num;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public void setPrice(long price) {
        this.price = price;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "cart{" +
                "cid=" + cid +
                ", uid=" + uid +
                ", pid=" + pid +
                ", price=" + price +
                ", num=" + num +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Cart cart = (Cart) o;
        return cid == cart.cid && uid == cart.uid && pid == cart.pid && price == cart.price && num == cart.num;
    }

    @Override
    public int hashCode() {
        return Objects.hash(cid, uid, pid, price, num);
    }
}
